SOURCES  = data_store.cc section_item.cc double_item.cc item.cc string_item.cc integer_item.cc

UTSOURCES = data_store_test.cc

HEADERS  = $(SOURCES:.cc=.h)
OBJECTS  = $(SOURCES:.cc=.o)
UTOBJECTS  = $(UTSOURCES:.cc=.o)

INCLUDE  = -I/sw/include/boost-1_33_1 
CXXFLAGS = -pg -g -O3 $(INCLUDE) -Wall

# Linux
#DEFINES  = -DLinux
#LIBS     = -lglut -lGL -lboost_thread

# OS X
LIBS     = -L/sw/lib $(GLFIX)

all: unit_tests libdatastore.so

data_store: data_store.cc $(OBJECTS)
	g++ $(DEFINES) $(CXXFLAGS) $(INCLUDE) -L/usr/lib -L/usr/X11R6/lib/ $(OBJECTS) $(LIBS) data_store.cc -o $@

unit_tests: unit_test.cc $(OBJECTS) $(UTOBJECTS)
	g++ $(DEFINES) $(CXXFLAGS) $(INCLUDE) -L/usr/lib -L/usr/X11R6/lib/ $(OBJECTS) $(UTOBJECTS) $(LIBS) -lgtest unit_test.cc -o $@

libdatastore.so: data_store.cc $(OBJECTS)
	g++ -dynamiclib -O3 -Wall $(INCLUDE) $(OBJECTS) -o libdatastore.so
	cp libdatastore.so ..
	cp libdatastore.so ../../predict_qt/

clean:
	rm -f data_store unit_tests gmon.out *.o

tar:    clean
	cd ..; tar zcvf data_store.tgz data_store

tags:   
	etags *.cc *.h

# rule for building dependency lists, and writing them to a file
# named ".depend".
depend: .depend $(HEADERS)
	rm -f .depend
	gcc -M $(DEFINES) $(SOURCES) $(INCLUDE) > .depend

# now add a line to include the dependency list.
include .depend

